var references = require('./reference');

var GetInstance = function()
{
    var instance;
    
    var RefMgr = function()
    {
        if(instance === undefined)
        {
            instance = new RefMgr;
        }
        
        return instance;
    }
    
    RefMgr.getInstance = function() {
        return RefMgr.apply(null, Array.prototype.slice.call(arguments));
    }
    
    //initialize..
    RefMgr.Initialize = function()
    {
        var filesystem  = require('fs');
        
        references.Parse_RefCardRatios( filesystem );
        references.Parse_RefAreas( filesystem );
        references.Parse_RefBosses( filesystem );
    };
    
    RefMgr.GetRefArea = function( id )
    {
        return references.GetRefArea( id );
    };
    
    return RefMgr;
};

exports.GetInstance = GetInstance;
